package DemoText;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 最小字符串
 */
public class LuoGuP10910 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), m = in.nextInt();
        if (n == 0) {
            String s1 = in.next();
            String s2 = in.next();
            char[] nums2 = new char[m];
            for (int i = 0; i < m; i++)
                nums2[i] = s2.charAt(i);
            Arrays.sort(nums2);
            for (char ch : nums2) System.out.print(ch);
        } else if (m == 0) {
            String s1 = in.next();
            String s2 = in.next();
            for (int i = 0; i < n; i++) System.out.print(s1.charAt(i));
        }else {
            char[] nums1 = new char[n];
            char[] nums2 = new char[m];
            char[] nums3 = new char[m + n];
            String s1 = in.next(), s2 = in.next();
            for (int i = 0; i < n; i++)
                nums1[i] = s1.charAt(i);
            for (int i = 0; i < m; i++)
                nums2[i] = s2.charAt(i);
            Arrays.sort(nums2);
            int i = 0, j = 0, k = 0;
            while (i < m && j < n) {
                if (nums2[i] < nums1[j]) nums3[k++] = nums2[i++];
                else nums3[k++] = nums1[j++];
            }
            while (i < m) nums3[k++] = nums2[i++];
            while (j < n) nums2[k++] = nums2[j++];
            for (char ch : nums3) System.out.print(ch);
        }
    }
}
